/* General Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: #f7f7f7;
  color: #333;
}

.homepage {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 10px;
  position: relative;
}

/* Leaderboard Styles */
.leaderboard-container {
  position: fixed;
  right: 20px;
  top: 100px;
  z-index: 100;
  width: 210px;
}

/* Featured Video Banner */
.featured-video {
  position: relative;
  height: 500px;
  background-size: cover;
  background-position: center;
  color: white;
  display: flex;
  align-items: flex-end;
  margin-bottom: 30px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.featured-video::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.3) 30%,
    rgba(0, 0, 0, 0.6) 70%,
    rgba(0, 0, 0, 0.8) 100%
  );
}

.video-cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.featured-video:hover .video-cover-image {
  transform: scale(1.02);
}

.video-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
  z-index: 2;
  animation: slideUp 0.8s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.video-title {
  font-size: 36px;
  margin-bottom: 12px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  text-align: left;
  line-height: 1.2;
  background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.video-description {
  font-size: 18px;
  max-width: 700px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  text-align: left;
  line-height: 1.5;
  opacity: 0.95;
  margin-bottom: 20px;
}

/* Dot Navigation */
.dot-navigation {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 12px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.dot:hover {
  background-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.1);
}

.dot.active {
  background-color: white;
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
}

/* Arrow Navigation */
.arrow-navigation {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 3;
}

.arrow {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.arrow:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.arrow:active {
  transform: scale(0.95);
}

/* Video Section with Tabs */
.video-section {
  margin-bottom: 40px;
}

.video-tabs {
  width: 100%;
}

.tabs-list {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.home-tab-button {
  width: 110px;
  padding: 10px 16px;
  margin: 10px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background-color: #f8f9fa;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.home-tab-button:hover {
  background-color: #e9ecef;
  color: #333;
}

.home-tab-button.active {
  background-color: #007bff;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

/* 响应式设计 - 在小屏幕上调整tab布局 */
@media (max-width: 768px) {
  .tabs-list {
    justify-content: center;
  }

  .home-tab-button {
    flex: 1;
    min-width: 80px;
    font-size: 12px;
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .tabs-list {
    flex-direction: column;
    gap: 4px;
  }

  .home-tab-button {
    width: 100%;
  }
}

.tab-trigger {
  flex: 1;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.3s ease;
  background-color: transparent;
  color: #666;
}

.tab-trigger[data-state="active"] {
  background-color: #007bff;
  color: white;
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.tab-trigger:hover:not([data-state="active"]) {
  background-color: #f8f9fa;
  color: #333;
}

.tab-content {
  width: 100%;
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.video-card {
  background-color: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.video-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.video-thumbnail {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  overflow: hidden;
}

.video-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 2px;
}

.live-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background-color: #ff4757;
  color: white;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 2px;
}

.video-details {
  padding: 12px;
}

.video-name {
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.4;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  color: #333;
  text-shadow: none;
}

.video-meta {
  font-size: 12px;
  color: #777;
}

.creator-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.video-tag {
  color: #ff6b81;
  font-weight: 500;
}

.creator-name {
  color: #555;
}

.upload-time::before {
  content: "•";
  margin: 0 5px;
}

.video-stats {
  display: flex;
  align-items: center;
  gap: 15px;
}

.views,
.comments {
  display: flex;
  align-items: center;
}

.icon-play::before {
  content: "▶";
  margin-right: 4px;
  font-size: 10px;
}

.icon-comment::before {
  content: "💬";
  margin-right: 4px;
  font-size: 12px;
}

.category-tag {
  background-color: #ffeaa7;
  color: #d35400;
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* Loading, Error, Empty States */
.loading,
.error,
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  font-size: 16px;
}

.loading {
  color: #666;
}

.error {
  color: #ff4757;
  background-color: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
}

.empty {
  color: #999;
}

/* Leaderboard Styles */
.leaderboard {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.leaderboard-header {
  padding: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.leaderboard-header h3 {
  text-align: center;
  margin-bottom: 10px;
  font-size: 16px;
  color: #333;
}

.leaderboard-tabs {
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  gap: 10px;
}

.leaderboard-tabs span {
  font-size: 12px;
}

.leaderboard-tabs .tab.active {
  background-color: #1a2a3a;
  color: white;
}

.leaderboard-content {
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #f5f5f5;
  transition: background-color 0.3s ease;
}

.leaderboard-item:hover {
  background-color: #f9f9f9;
}

.leaderboard-item .rank {
  width: 25px;
  text-align: center;
  margin-right: 10px;
}

.top-rank {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  text-align: center;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  font-size: 9px;
}

.rank-1 {
  background-color: #f1c40f; /* Gold */
}

.rank-2 {
  background-color: #bdc3c7; /* Silver */
}

.rank-3 {
  background-color: #e67e22; /* Bronze */
}

.normal-rank {
  color: #777;
  font-size: 12px;
}

.user-info {
  flex: 1;
}

.rank-user-name {
  font-size: 12px;
  color: #333;
}

.points {
  font-weight: 500;
  color: #ff6b81;
  font-size: 12px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .homepage {
    padding: 0 5px;
  }

  .leaderboard-container {
    position: static;
    width: 100%;
    margin-bottom: 20px;
  }

  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .tabs-list {
    flex-direction: column;
    gap: 4px;
  }

  .tab-trigger {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .video-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .featured-video {
    height: 350px;
    border-radius: 12px;
    margin-bottom: 20px;
  }

  .video-info {
    padding: 20px;
  }

  .video-title {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .video-description {
    font-size: 14px;
    margin-bottom: 15px;
  }

  .arrow {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .dot-navigation {
    bottom: 20px;
    gap: 8px;
    padding: 6px 12px;
  }

  .dot {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 480px) {
  .featured-video {
    height: 280px;
  }

  .video-title {
    font-size: 20px;
  }

  .video-description {
    font-size: 13px;
  }

  .arrow-navigation {
    padding: 0 10px;
  }
}
